<?php

namespace app\admin\controller;

use cmf\controller\AdminBaseController;
use think\Db;
use think\Request;

class QuantController extends AdminBaseController
{


    public function robot()
    {

        $where = [];
        $requ = request()->param();
        !empty($requ['uid']) ? $where['uid'] = $requ['uid'] : '';
        !empty($requ['platform']) ? $where['platform'] = $requ['platform'] : '';
        //!empty($requ['qrobot_id']) ? $where['qrobot_id'] = $requ['qrobot_id'] : '';

        $size = 15;
        $data =  Db::name('quant_robot')->where($where)->order('id desc')->paginate($size, false, ['query' => request()->param()]); //->where(['status' => 1])
        $this->assign('datas', $data->items());
        $this->assign('num', $data->total());
        $this->assign('page', $data->render());
        return $this->fetch();
    }

    public function order()
    {
        $where = [];
        $requ = request()->param();
        !empty($requ['uid']) ? $where['uid'] = $requ['uid'] : '';
        !empty($requ['platform']) ? $where['platform'] = $requ['platform'] : '';
        !empty($requ['qrobot_id']) ? $where['qrobot_id'] = $requ['qrobot_id'] : '';

        $size = 15;
        $data =  Db::name('quant_robot_order')->where($where)->order('id desc')->paginate($size, false, ['query' => request()->param()]); //->where(['status' => 1])
        $this->assign('datas', $data->items());
        $this->assign('num', $data->total());
        $this->assign('page', $data->render());
        return $this->fetch();
    }

    public function log()
    {
        $where = [];
        $requ = request()->param();
        !empty($requ['uid']) ? $where['uid'] = $requ['uid'] : '';
        !empty($requ['platform']) ? $where['platform'] = $requ['platform'] : '';
        !empty($requ['qrobot_id']) ? $where['qrobot_id'] = $requ['qrobot_id'] : '';        

        $size = 15;
        $data =  Db::name('quant_robot_log')->where($where)->order('id desc')->paginate($size, false, ['query' => request()->param()]); //->where(['status' => 1])
        $this->assign('datas', $data->items());
        $this->assign('num', $data->total());
        $this->assign('page', $data->render());
        return $this->fetch();
    }

    public function revenue()
    {
        $where = [];
        $requ = request()->param();
        !empty($requ['uid']) ? $where['uid'] = $requ['uid'] : '';
        !empty($requ['platform']) ? $where['platform'] = $requ['platform'] : '';
        !empty($requ['qrobot_id']) ? $where['qrobot_id'] = $requ['qrobot_id'] : '';
                
        $size = 15;
        $data =  Db::name('quant_robot_revenue')->where($where)->order('id desc')->paginate($size, false, ['query' => request()->param()]); //->where(['status' => 1])
        $this->assign('datas', $data->items());
        $this->assign('num', $data->total());
        $this->assign('page', $data->render());
        return $this->fetch();
    }
}
